package com.camel.network.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import com.camel.core.entity.BasePaginationEntity;
import com.camel.core.model.Cdrinfo;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

/**
 *
 * @TableName zs_cdrinfo
 */
@TableName(value ="zs_cdrinfo")
@Data
public class ZsCdrinfo extends BasePaginationEntity implements Serializable {
    /**
     *
     */
    @TableId(value = "id")
    private String id;

    /**
     *
     */
    @TableField(value = "call_uuid")
    private String callUuid;

    /**
     *
     */
    @TableField(value = "uuids")
    private String uuids;

    /**
     *
     */
    @TableField(value = "call_type")
    private String callType;

    /**
     *
     */
    @TableField(value = "caller_num")
    private String callerNum;

    /**
     *
     */
    @TableField(value = "callee_num")
    private String calleeNum;

    /**
     * 开始时间
     */
    @TableField(value = "start_time")
    private String startTime;

    /**
     * 客户通话时长
     */
    @TableField(value = "call_lasts_time")
    private String callLastsTime;

    /**
     *
     */
    @TableField(value = "agent_duration")
    private String agentDuration;

    /**
     *
     */
    @TableField(value = "caller_agent_num")
    private String callerAgentNum;

    /**
     *
     */
    @TableField(value = "callee_agent_num")
    private String calleeAgentNum;

    /**
     *
     */
    @TableField(value = "caller_agent_group_name")
    private String callerAgentGroupName;

    /**
     *
     */
    @TableField(value = "record_file")
    private String recordFile;

    /**
     *
     */
    @TableField(value = "legs")
    private String legs;

    /**
     *
     */
    @TableField(value = "grade")
    private String grade;

    /**
     *
     */
    @TableField(value = "taskid")
    private String taskid;

    /**
     *
     */
    @TableField(value = "taskname")
    private String taskname;

    /**
     *
     */
    @TableField(value = "ivr_dtmf")
    private String ivrDtmf;

    /**
     * 用户ID
     */
    @TableField(value = "uid")
    private Integer uid;

    /**
     *
     */
    @TableField(value = "survey_id")
    private Integer surveyId;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public boolean isNotValidData() {
        return StringUtils.isBlank(this.getCallLastsTime()) || StringUtils.isBlank(this.recordFile) || StringUtils.equals("0", this.getCallLastsTime());
    }

    public static ZsCdrinfo fromCdr(Cdrinfo info) {
        ZsCdrinfo cdrinfo = new ZsCdrinfo();
        cdrinfo.setCallUuid(info.getCall_uuid());
        cdrinfo.setUuids(info.getUuids());
        cdrinfo.setCallType(info.getCall_type());
        cdrinfo.setCallerNum(info.getCaller_num());
        cdrinfo.setCalleeNum(info.getCallee_num());
        cdrinfo.setStartTime(info.getStart_time());
        cdrinfo.setCallLastsTime(info.getCall_lasts_time());
        cdrinfo.setAgentDuration(info.getAgent_duration());
        cdrinfo.setCallerAgentNum(info.getCaller_agent_num());
        cdrinfo.setCalleeAgentNum(info.getCallee_agent_num());
        cdrinfo.setCallerAgentGroupName(info.getCaller_agent_group_name());
        cdrinfo.setRecordFile(info.getRecordFile());
        cdrinfo.setGrade(info.getGrade());
        cdrinfo.setTaskid(info.getTaskid());
        cdrinfo.setTaskname(info.getTaskname());
        return cdrinfo;
    }
}
